Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: remove the feature to change the default non-root user name via USER env var #891

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

eitsupi
Copy link
Member

@eitsupi eitsupi commented Dec 18, 2024

Fix #489
Close #889

@eitsupi eitsupi requested a review from cboettig December 18, 2024 03:28
Copy link
Member

@cboettig cboettig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely streamlined here, this makes sense to me!

@eitsupi eitsupi merged commit b7509ce into master Dec 19, 2024
@eitsupi eitsupi deleted the shouldnot-rename branch December 19, 2024 12:30
@rmjstn
Copy link

rmjstn commented Jan 23, 2025

Hello,

The modification USER=${DEFAULT_USER} vs USER=${USER:=${DEFAULT_USER}} caused a problem. If I defined the USER in the Docker Compose file, it's ignored. USER is equal to DEFAULT_USER, and USERID is equals to that defined in the Docker Compose file.

    echo "deleting the default user"
    userdel "$DEFAULT_USER"
    echo "creating new $USER with UID $USERID"
    useradd -m "$USER" -u "$USERID"
    mkdir -p "${USERHOME}"
    chown -R "$USER" "${USERHOME}"
    usermod -a -G staff "$USER"

Docker Compose file :

    environment:
      - USER=remy
      - USERID=10042

Logs :

deleting the default user
creating new rstudio with UID 10042

If I set USER=${USER:=${DEFAULT_USER}} in init_userconf.sh, it works for me.

Is there something I'm missing ?

Thanks,

@eitsupi
Copy link
Member Author

eitsupi commented Jan 23, 2025

I'm sorry, but I don't understand what you are trying to say.
The purpose of this change is to disallow username changes using the USER environment variable.
In other words, the behavior you observed is as we intended and there is nothing wrong with it.

@rmjstn
Copy link

rmjstn commented Jan 23, 2025

Ha OK. Sorry, I misunderstood the purpose of the modification.
This page had to explain how to value the USER variable.
I use this feature to map the user with the host one. I map the volume "/etc/shadow:/etc/shadow" for using the same password. So I've got this error while providing the USERID :

creating new rstudio with UID 10042
useradd: failure while writing changes to /etc/shadow

I don't want to configure the password in the Docker Compose file.

Thanks

@eitsupi
Copy link
Member Author

eitsupi commented Jan 23, 2025

Ha OK. Sorry, I misunderstood the purpose of the modification. This page had to explain how to value the USER variable. I use this feature to map the user with the host one. I map the volume "/etc/shadow:/etc/shadow" for using the same password. So I've got this error while providing the USERID :

creating new rstudio with UID 10042
useradd: failure while writing changes to /etc/shadow

I don't want to configure the password in the Docker Compose file.

Thanks for the response. Okay, I understand your use case.

However, the use of this environment variable has been deprecated for the past several years.
See #490

If you prefer to use an arbitrary user name, build the image yourself as described here. (Perhaps this is worth adding to the documentation, which I will work on in due time if I remember)
https://github.com/rocker-org/rocker-versioned2/blob/master/NEWS.md#2024-12

@rmjstn
Copy link

rmjstn commented Jan 23, 2025

What I find disturbing (if I understand correctly the problem I encountered) is that the content of the rocker/verse:4.4.2 image has changed over time without being reversioned (4.4.2.1, 4.4.2.2...). If a server had an old cached image it worked. This means that the process is not reproducible.

@eitsupi
Copy link
Member Author

eitsupi commented Jan 23, 2025

What I find disturbing (if I understand correctly the problem I encountered) is that the content of the rocker/verse:4.4.2 image has changed over time without being reversioned (4.4.2.1, 4.4.2.2...). If a server had an old cached image it worked. This means that the process is not reproducible.

See https://rocker-project.org/use/reproducibility.html.

@rmjstn
Copy link

rmjstn commented Jan 23, 2025

Thanks for this clarification.

eitsupi added a commit to rocker-org/website that referenced this pull request Jan 25, 2025
Remove some outdated descriptions.

And, I would like to add here that there are so many questions about
changing user names that it is tedious to answer.
Ref: rocker-org/rocker-versioned2#489, rocker-org/rocker-versioned2#889,
rocker-org/rocker-versioned2#891 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants